﻿using Microsoft.CodeAnalysis.CSharp.Syntax;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UMLSynthesizer.CSharpAnalyzer.Helpers;
using UMLSynthesizer.LangAnalyzer.Expressions;
using UMLSynthesizer.LangAnalyzer.Statements;

namespace UMLSynthesizer.CSharpAnalyzer.Expressions
{
    class CSharpBinaryExpression : CSharpExpressionBase, IBinaryExpression
    {
        #region Fields

        CSharpExpressionHelper leftExprHelper;
        CSharpExpressionHelper rightExprHelper;

        #endregion

        #region Constructor

        public CSharpBinaryExpression(BinaryExpressionSyntax expressionNode,
            IExpressionBase parentExpression,
            IStatementBase parentStatement,
            ExpressionKinds kind)
            : base(expressionNode, parentExpression, parentStatement, kind)
        {
            leftExprHelper = new CSharpExpressionHelper(this, parentStatement, () => expressionNode.Left);
            rightExprHelper = new CSharpExpressionHelper(this, parentStatement, () => expressionNode.Right);
        }

        #endregion

        #region Properties

        public IExpressionBase LeftExpression { get { return leftExprHelper.Expression; } }
        public IExpressionBase RightExpression { get { return rightExprHelper.Expression; } }

        #endregion
    }
}
